using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using DAL;
using BUS;
using Utility;

public partial class admin_Danhsachdoanhnghiep : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
           
            LoadData();
        }

    }
    private void LoadData()
    {
        Criteria cri = new Criteria();

        int total = 0;
        if (txt_Tendn.Text != "")
            cri.add(Condition.AND, tbDoanhNghiepColumns.TenDN .ToString(), Condition.LIKE, txt_Tendn.Text);       


        tbDoanhNghiepCollection doanhnghiepCollection = tbDoanhNghiepBUS.Get(cri.Criter, hyperlinkPager.CurrentIndex, hyperlinkPager.PageSize,
        tbDoanhNghiepColumns.MaDN .ToString(), OrderDirection.ASC.ToString(), out total);
        Repeater1.DataSource = doanhnghiepCollection;
        Repeater1.DataBind();
        hyperlinkPager.ItemCount = total;
        
    }

    protected void hyperlinkPager_Command(object sender, CommandEventArgs e)
    {
        hyperlinkPager.CurrentIndex = Convert.ToInt32(e.CommandArgument);
        LoadData();
    }
    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item
        || e.Item.ItemType == ListItemType.AlternatingItem)
        {
           
            tbDoanhNghiep doanhnghiep = (tbDoanhNghiep)e.Item.DataItem;
            
        }
    }

    protected void btn_Search_Click(object sender, EventArgs e)
    {
        LoadData();
    }
}
